﻿Ext.define('app.system.substance.Index',
{
    extend: 'Ext.grid.Panel',
    border: true,
    title: '物质库',
    tbar: [],
    controller: 'substance',
    //viewModel: {
    //    type: 'compoundModel'
    //},
    requires: ['app.system.substance.SubstanceController'],
    viewConfig: {
        enableTextSelection: true //可以复制单元格文字
    },
    forceFit: true,
    multiColumnSort: true,
    initComponent: function () {
        var me = this;
        me.items = [];
        me.tbar = [
            {
                text: '新增', iconCls: "add", handler: 'onAdd'
            }
            //{
            //    text: '编辑', iconCls: "edit", bind: { disabled: '{btnHidden}' }, handler: 'onEdit'
            //},
            //{
            //    text: '删除', iconCls: "delete", bind: { disabled: '{btnHidden}' }, handler: 'onRemove'
            //},
            //"->",
            //{
            //    text: '查询', iconCls: "search", menu: {
            //        xtype: 'menu',
            //        plain: true,
            //        items: me.searchPanel
            //    }
            //}
        ];
        me.store = Ext.create("app.ux.PagePrmStore", { url: '/api/services/app/substance/GetAll' });

        me.bbar = new Ext.toolbar.Paging({
            store: me.store,
            displayInfo: true,
            displayMsg: "显示{0}-{1}条,共计{2}条",
            emptyMsg: "没有数据"
        });
        me.callParent(arguments);
    },
    columns: [
        { header: "Cas", dataIndex: 'cas' },
        { header: "中文名", dataIndex: 'cnName' },
        { header: "英文名", dataIndex: 'enName' },
        { header: "分子式", dataIndex: 'formula' },
        { header: "分子量", dataIndex: 'molecularWeight' },
        { header: "高风险", dataIndex: 'highRisk' },
    ]
});
